
package com.wwy.monitor.model.enumeration;

public enum MonitorEnvEnum {

    ENV_LOCAL("local", 1),
    ENV_DAILY("daily", 2),
    ENV_SIT("sit", 3),
    ENV_PREPUB("prepub", 4),
    ENV_PREPUB_NA62("prepub-na62", 4),
    ENV_PREPUB_NA610("prepub--na610", 4),
    ENV_PREPUB_SH("prepub-sh", 4),
    ENV_PREPUB_SZ("prepub-sz", 4),
    ENV_PUBLISH("publish", 5),
    ENV_PUBLISH_NA62("publish-na62", 5),
    ENV_PUBLISH_SH("publish-sh", 5),
    ENV_PUBLISH_NA620("publish--na620", 5),
    ENV_PUBLISH_NA610("publish--na610", 5),
    ENV_PUBLISH_SZ("publish-sz", 5);

    String desc;
    int level;

    MonitorEnvEnum(String desc, int level) {
        this.desc = desc;
        this.level = level;
    }

    public int getLevel() {
        return level;
    }

    public String getDesc() {
        return desc;
    }

    public static Integer parseStatus(String desc) {
        Integer status = parse(desc);
        if (status == null) {
            status = ENV_LOCAL.level;
        }
        return status;
    }

    private static Integer parse(String desc) {
        MonitorEnvEnum[] values = values();
        for (MonitorEnvEnum v : values) {
            if (v.getDesc().equals(desc)) {
                return v.getLevel();
            }
        }
        return null;
    }
}